package com.share.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.stereotype.Repository;

/**
 * author:caifan
 * date:2019/3/23
 */
@MapperScan
@Repository
public interface CityMapper {

    @Results(id = "insertCity", value = {
            @Result(property = "provinceId", column = "province_id"),
            @Result(property = "cityName", column = "city_name")
    }    )
    @Insert("insert into city (province_id, city_name, description) values(#{provinceId}, #{cityName}, #{description})")
    int insertCity(@Param("provinceId")Integer provinceId, @Param("cityName")String cityName, @Param("description")String description);
}
